// @ts-nocheck
import router from "@/router";
import {markRaw, ref} from 'vue';
import { Lock, Tools, TrophyBase, UserFilled, WalletFilled } from "@element-plus/icons-vue";
import {useUserStore} from "@/stores/userStore";


const userStore = useUserStore()
export const userData = userStore.userData


type MenuItem = {
    label: string;
    isActive: boolean;
    icon: any;
    urlname: string;
};

// 创建菜单项数组
export const menuItems = ref<MenuItem[]>([
    { label: '个人资料', isActive: true, icon: markRaw(UserFilled), urlname: 'Personal_data' },
    { label: '账户安全', isActive: false, icon: markRaw(Lock), urlname: 'Home' },
    { label: '神秘点数', isActive: false, icon: markRaw(TrophyBase), urlname: 'Personal_data' },
    { label: '账户余额', isActive: false, icon: markRaw(WalletFilled), urlname: 'Personal_data' },
    { label: '系统设置', isActive: false, icon: markRaw(Tools), urlname: 'Settings' },
]);

// 设置激活的菜单项
export const setActive = async (item: MenuItem) => {
    menuItems.value.forEach((menuItem) => {
        menuItem.isActive = menuItem === item;
    });
    await router.push({name: item.urlname});
    menu_name.value = item.label;
};

// 菜单名称绑定
export const menu_name = ref('个人资料');